.class public Lrexsee/multimedia/VideoView;
.super Landroid/view/SurfaceView;
.source "VideoView.java"


# static fields
.field private static final CLASS_NAME:Ljava/lang/String; = "VideoView"

.field public static final EVENT_ONVIDEOBUFFERINGUPDATED:Ljava/lang/String; = "onVideoBufferingUpdated"

.field public static final EVENT_ONVIDEOPLAYCOMPLETED:Ljava/lang/String; = "onVideoPlayCompleted"

.field public static final EVENT_ONVIDEOPLAYERINFO:Ljava/lang/String; = "onVideoPlayerInfo"

.field public static final EVENT_ONVIDEOSEEKCOMPLETED:Ljava/lang/String; = "onVideoSeekCompleted"

.field public static final EVENT_ONVIDEOSIZECHANGED:Ljava/lang/String; = "onVideoSizeChanged"

.field public static final EVENT_ONVIDEOSURFACECREATED:Ljava/lang/String; = "onVideoSurfaceCreated"


# instance fields
.field public isLooping:Z

.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mContext:Landroid/content/Context;

.field private final mId:Ljava/lang/String;

.field public mediaPlayer:Landroid/media/MediaPlayer;

.field public path:Ljava/lang/String;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;Ljava/lang/String;Ljava/lang/String;Z)V
    .locals 4
    .param p1, "browser"    # Lrexsee/core/browser/Browser;
    .param p2, "id"    # Ljava/lang/String;
    .param p3, "url"    # Ljava/lang/String;
    .param p4, "looping"    # Z

    .prologue
    const/4 v3, 0x1

    const/4 v2, -0x1

    .line 35
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p0, v0}, Landroid/view/SurfaceView;-><init>(Landroid/content/Context;)V

    .line 31
    const/4 v0, 0x0

    iput-object v0, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    .line 37
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/multimedia/VideoView;->mContext:Landroid/content/Context;

    .line 38
    iput-object p1, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    .line 39
    iput-object p2, p0, Lrexsee/multimedia/VideoView;->mId:Ljava/lang/String;

    .line 40
    iput-object p3, p0, Lrexsee/multimedia/VideoView;->path:Ljava/lang/String;

    .line 41
    iput-boolean p4, p0, Lrexsee/multimedia/VideoView;->isLooping:Z

    .line 43
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onVideoBufferingUpdated"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 44
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onVideoPlayCompleted"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 45
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onVideoPlayerInfo"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 46
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onVideoSeekCompleted"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 47
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onVideoSizeChanged"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 48
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v1, "onVideoSurfaceCreated"

    invoke-virtual {v0, v1}, Lrexsee/core/browser/clazz/EventList;->add(Ljava/lang/String;)V

    .line 50
    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->getHolder()Landroid/view/SurfaceHolder;

    move-result-object v0

    new-instance v1, Lrexsee/multimedia/VideoView$1;

    invoke-direct {v1, p0}, Lrexsee/multimedia/VideoView$1;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-interface {v0, v1}, Landroid/view/SurfaceHolder;->addCallback(Landroid/view/SurfaceHolder$Callback;)V

    .line 72
    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->getHolder()Landroid/view/SurfaceHolder;

    move-result-object v0

    const/4 v1, 0x3

    invoke-interface {v0, v1}, Landroid/view/SurfaceHolder;->setType(I)V

    .line 73
    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->getHolder()Landroid/view/SurfaceHolder;

    move-result-object v0

    invoke-interface {v0, v2, v2}, Landroid/view/SurfaceHolder;->setFixedSize(II)V

    .line 74
    invoke-virtual {p0, v3}, Lrexsee/multimedia/VideoView;->setFocusable(Z)V

    .line 75
    invoke-virtual {p0, v3}, Lrexsee/multimedia/VideoView;->setFocusableInTouchMode(Z)V

    .line 76
    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->requestFocus()Z

    .line 77
    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->requestLayout()V

    .line 78
    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->invalidate()V

    .line 80
    return-void
.end method

.method static synthetic access$0(Lrexsee/multimedia/VideoView;)Ljava/lang/String;
    .locals 1

    .prologue
    .line 27
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mId:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$1(Lrexsee/multimedia/VideoView;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 26
    iget-object v0, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method


# virtual methods
.method public openVideo()V
    .locals 9

    .prologue
    .line 83
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->path:Ljava/lang/String;

    if-eqz v6, :cond_0

    iget-object v6, p0, Lrexsee/multimedia/VideoView;->path:Ljava/lang/String;

    invoke-virtual {v6}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v6

    const-string v7, ""

    invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_1

    .line 218
    :cond_0
    :goto_0
    return-void

    .line 84
    :cond_1
    new-instance v1, Landroid/content/Intent;

    const-string v6, "com.android.music.musicservicecommand"

    invoke-direct {v1, v6}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    .line 85
    .local v1, "i":Landroid/content/Intent;
    const-string v6, "command"

    const-string v7, "pause"

    invoke-virtual {v1, v6, v7}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 86
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mContext:Landroid/content/Context;

    invoke-virtual {v6, v1}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V

    .line 87
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    if-eqz v6, :cond_2

    .line 88
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    invoke-virtual {v6}, Landroid/media/MediaPlayer;->reset()V

    .line 89
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    invoke-virtual {v6}, Landroid/media/MediaPlayer;->release()V

    .line 90
    const/4 v6, 0x0

    iput-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    .line 93
    :cond_2
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->path:Ljava/lang/String;

    const-string v7, "raw://"

    invoke-virtual {v6, v7}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_4

    .line 94
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mContext:Landroid/content/Context;

    invoke-virtual {v6}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    .line 95
    .local v4, "r":Landroid/content/res/Resources;
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mContext:Landroid/content/Context;

    invoke-virtual {v6}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v3

    .line 96
    .local v3, "packageName":Ljava/lang/String;
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->path:Ljava/lang/String;

    const/4 v7, 0x6

    invoke-virtual {v6, v7}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v6

    const-string v7, "raw"

    invoke-virtual {v4, v6, v7, v3}, Landroid/content/res/Resources;->getIdentifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I

    move-result v2

    .line 97
    .local v2, "id":I
    if-nez v2, :cond_3

    .line 98
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v7

    const-string v8, "The specified resource does not found."

    invoke-virtual {v6, v7, v8}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 101
    :cond_3
    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "android.resource://"

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v6, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "/"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v6}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v5

    .line 106
    .end local v2    # "id":I
    .end local v3    # "packageName":Ljava/lang/String;
    .end local v4    # "r":Landroid/content/res/Resources;
    .local v5, "uri":Landroid/net/Uri;
    :goto_1
    :try_start_0
    new-instance v6, Landroid/media/MediaPlayer;

    invoke-direct {v6}, Landroid/media/MediaPlayer;-><init>()V

    iput-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    .line 107
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    iget-boolean v7, p0, Lrexsee/multimedia/VideoView;->isLooping:Z

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setLooping(Z)V

    .line 108
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$2;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$2;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnBufferingUpdateListener(Landroid/media/MediaPlayer$OnBufferingUpdateListener;)V

    .line 118
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$3;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$3;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnCompletionListener(Landroid/media/MediaPlayer$OnCompletionListener;)V

    .line 129
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$4;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$4;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnSeekCompleteListener(Landroid/media/MediaPlayer$OnSeekCompleteListener;)V

    .line 139
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$5;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$5;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnErrorListener(Landroid/media/MediaPlayer$OnErrorListener;)V

    .line 161
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$6;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$6;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnInfoListener(Landroid/media/MediaPlayer$OnInfoListener;)V

    .line 193
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$7;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$7;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnPreparedListener(Landroid/media/MediaPlayer$OnPreparedListener;)V

    .line 199
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    new-instance v7, Lrexsee/multimedia/VideoView$8;

    invoke-direct {v7, p0}, Lrexsee/multimedia/VideoView$8;-><init>(Lrexsee/multimedia/VideoView;)V

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setOnVideoSizeChangedListener(Landroid/media/MediaPlayer$OnVideoSizeChangedListener;)V

    .line 210
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    iget-object v7, p0, Lrexsee/multimedia/VideoView;->mContext:Landroid/content/Context;

    invoke-virtual {v6, v7, v5}, Landroid/media/MediaPlayer;->setDataSource(Landroid/content/Context;Landroid/net/Uri;)V

    .line 211
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    invoke-virtual {p0}, Lrexsee/multimedia/VideoView;->getHolder()Landroid/view/SurfaceHolder;

    move-result-object v7

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setDisplay(Landroid/view/SurfaceHolder;)V

    .line 212
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    const/4 v7, 0x3

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setAudioStreamType(I)V

    .line 213
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    const/4 v7, 0x1

    invoke-virtual {v6, v7}, Landroid/media/MediaPlayer;->setScreenOnWhilePlaying(Z)V

    .line 214
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mediaPlayer:Landroid/media/MediaPlayer;

    invoke-virtual {v6}, Landroid/media/MediaPlayer;->prepareAsync()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto/16 :goto_0

    .line 215
    :catch_0
    move-exception v6

    move-object v0, v6

    .line 216
    .local v0, "e":Ljava/lang/Exception;
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->mBrowser:Lrexsee/core/browser/Browser;

    const-string v7, "VideoView"

    invoke-virtual {v6, v7, v0}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    goto/16 :goto_0

    .line 103
    .end local v0    # "e":Ljava/lang/Exception;
    .end local v5    # "uri":Landroid/net/Uri;
    :cond_4
    iget-object v6, p0, Lrexsee/multimedia/VideoView;->path:Ljava/lang/String;

    invoke-static {v6}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v5

    .restart local v5    # "uri":Landroid/net/Uri;
    goto/16 :goto_1
.end method
